from flask import Flask
import time
from datetime import datetime
app = Flask(__name__)


@app.route('/')
def hello_world():
    return 'Hello, World!'


@app.route('/delay')
def delay_hello_world():
    print('start delay_hello_world')
    start = time.time()
    time.sleep(10)
    seconds = time.time() - start
    return 'Hello, World! After {:.2f}s'.format(seconds)


@app.route('/task')
def task():
    print('start task')
    start = time.time()
    sum([i for i in range(10000000)])
    seconds = time.time() - start
    return 'task finnished! After {:.2f}s'.format(seconds)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8891, processes=10, threaded=False)
